<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Student extends CI_Controller {
	
	public function __construct(){
		parent::__construct();
		$this->load->model('student_model');
	}
	
	public function info($sid){
		$data['user'] = $this->student_model->info($sid);
		$data['radio'] = 'student';
		$this->showView('user',$data);
	}
	public function saveInfo(){
		$classid = $this->input->post('classid');
		$password= $this->input->post('password');
		$r = $this->student_model->save($classid,$password);
		$this->showView('suc',$r);
	}
	public function marking_stepTeacherList($sid){
		$data['radio'] = 'student';
		$data['ts'] = $this->student_model->teacherList($sid);
		$this->showView('teacherList',$data);
	}
	public function marking_stepOption($id){
		$data['id'] = $id;
		$data['radio'] = 'student';
		$this->load->model("option_model");
		$data['options'] = $this->option_model->getOptions();
		$this->load->model("iw_model");
		$data['iws'] = $this->iw_model->getStudentIw();
		$this->showView('marking',$data);
	}
	public function marking_stepSaveScore($id,$score){
		$this->load->model("score_model");
		$this->score_model->saveStudentScore($id,$score);
	}
	private function showView($view,$data){
		if($data){
			$this->load->view($view,$data);
		}else{
			$this->load->view('welcome_message');
		}
	}
	
}